Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Do not assume content of the SAMPLES_PROJECT_GLOB variable #164

Merged
merged 1 commit into from Feb 7, 2017

Conversation

dougbu
Copy link
Member

@dougbu dougbu commented Feb 7, 2017

  • samples folder may exist only to enable use of a modified SAMPLES_PROJECT_GLOB

Other alternatives to the Directory.Exists("samples") approach:

  • change default glob to something like sam*ples/*/*.csproj
    • that wouldn't require the samples folder but may in the future match something unintended
  • update PathResolver.shade in Sake to avoid Directory.GetFiles(path, ...) when path doesn't exist
    • could copy PathResolver.shade into KoreBuild to avoid updating Sake
    • but, this option can still hide real errors very easily

- samples folder may exist _only_ to enable use of a modified SAMPLES_PROJECT_GLOB

Other alternatives to the `Directory.Exists("samples")` approach:
- change default glob to something like `sam*ples/*/*.csproj`
  - that wouldn't require the samples folder but may in the future match something unintended
- update PathResolver.shade in Sake to avoid `Directory.GetFiles(path, ...)` when path doesn't exist
  - could copy PathResolver.shade into KoreBuild to avoid updating Sake
  - but, this option can still hide real errors very easily
@dougbu
Copy link
Member Author

dougbu commented Feb 7, 2017

@natemcmaster and @pranavkm this fix is useful for aspnet/Performance#206. My builds currently leave many projects (those only built because they're referenced from a test) in a half-baked state.

}
if (!BuildSrcOnly && Directory.Exists("samples") && Directory.EnumerateFiles("samples", "*.csproj", SearchOption.AllDirectories).Any())

if (!BuildSrcOnly && Directory.Exists("samples"))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put another way, alright if we require an empty samples folder to enable SAMPLES_PROJECT_GLOB. But requiring a (no-op) project is a bit much.

{
projectGlobs.AddRange(Files.Include(SAMPLES_PROJECT_GLOB).ToList());
projectGlobs.AddRange(Files.Include(SAMPLES_PROJECT_GLOB).ToList());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this line will still throw if SAMPLES_PROJECT_GLOB contains an entry that starts with a non-existent folder. One would hope those overriding this variable know what they're doing…

@dougbu dougbu merged commit 77454d8 into feature/msbuild Feb 7, 2017
@dougbu dougbu deleted the dougbu/use.globs.directly branch February 7, 2017 04:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants